cmake_minimum_required(VERSION 3.5)
project(SmartSpeaker)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

find_package(PkgConfig REQUIRED)
pkg_check_modules(ps REQUIRED IMPORTED_TARGET pocketsphinx)

add_compile_options(-Wall -D_GNU_SOURCE)

add_executable(test_record test_record.c)
target_link_libraries(test_record asound)

add_executable(test_play test_play.c)
target_link_libraries(test_play asound)

add_executable(pcm2wav pcm2wav.c)

add_executable(tts tts.c token.c config.c)
target_link_libraries(tts curl cjson)

add_executable(robot robot.c mqtt.c config.c)
target_link_libraries(robot curl cjson paho-mqtt3c)

add_library(snowboy-detect-c-wrapper STATIC snowboy/snowboy-detect-c-wrapper.cc)
target_compile_options(snowboy-detect-c-wrapper PRIVATE -D_GLIBCXX_USE_CXX11_ABI=0)

add_executable(record record.c stt.c config.c token.c)
target_link_libraries(record snowboy-detect-c-wrapper ${CMAKE_SOURCE_DIR}/snowboy/libsnowboy-detect.a cjson curl asound cblas)

add_executable(listen listen.c)
target_link_libraries(listen PRIVATE pocketsphinx m)
